<!-- 轨迹页面 -->
<template>
  <TitleBalance :name="`轨迹信息`">
    <template slot="right">
    </template>
    <!-- 内容 -->
    <template slot="center">
      <table :style="table"
             border="1px"
             cellspacing="0px"
             cellpadding="10px">
        <thead>
          <tr class="table-header">
            <td v-for="(itm, index) in columns"
                :key="index"
                :width="itm.with">{{itm.label}}</td>
          </tr>
        </thead>
        <tbody v-for="(item, index) in tableData"
               :key="index">
          <td>{{ index }}</td>
          <td>{{item.time}}</td>
          <td>
            <span>{{ item.type === 0 ? 'GPS' : 'LBS' }}</span>
          </td>
          <td>{{item.temperature || '--' }}</td>
          <td>{{item.humidity || '--'}}</td>
          <td>{{item.address}}</td>
        </tbody>
      </table>
    </template>
  </TitleBalance>
</template>

<script>
// import VirtualScroll from './ElTableVirtualScroll'
import TitleBalance from './TitleBalance.vue';
// import cert from '@/api/modules/cert'

const columns = [
  {
    label: "序号",
    with: '40px'
  },
  {
    label: '定位时间'
  },
  {
    label: '定位类型'
  },
  {
    label: '温度（℃）'
  },
  {
    label: '湿度（℃）'
  },
  {
    label: '位置'
  }
]

export default {
  name: 'CertIocus',
  components: { TitleBalance },
  props: {
    value: {
      type: Array,
      default: () => []
    }
  },
  data () {
    return {
      // tableData: [],
      columns,
      // pageIndex: 1,
      // pageSize: 9999,
      // isRequest: false
    }
  },
  computed: {
    tableData () {
      return this.value
    },
    table () {
      return {
        fontSize: '12px',
        width: "100%",
        fontWeight: '500',
        fontFamily: 'DFKai-scrollBy',
        borderCollapse: "collapse",
        margin: "0 auto"
      }
    },
  },
  mounted () {
    // this.getCertChainEvidencePosition(this.pageIndex, this.pageSize)
  },
  // methods: {
  //   async getCertChainEvidencePosition (pageIndex, pageSize) {
  //     let orderId = this.value
  //     let response = await cert.getCertPosition(orderId, pageIndex, pageSize)
  //     if (response?.data?.records) {
  //       this.tableData = response?.data?.records
  //       this.isRequest = true
  //     }
  //   },
  // }
}
</script>

<style scoped>
@media print {
  /* 确保表头在每页开头显示 */
  .table-header {
    position: sticky;
    top: 0;
  }
  /* 在表头之前插入分页符 */
  .table-header::before {
    display: block;
    page-break-before: always;
  }
}
</style>
